<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
		<title>后台管理系统</title>
		<!-- 样 式 文 件 -->
		<link rel="stylesheet" href="/static/component/pear/css/pear.css" />
		<link rel="stylesheet" href="/static/admin/css/other/login.css" />
	</head>
    <!-- 代 码 结 构 -->
	<body>
		<div class="login-left">

		</div>
		<div class="login-right">
			<form class="layui-form" action="javascript:void(0);">
				<div class="layui-form-item">
					<div class="title" style="color: #303133!important;">FlyWhale(飞鲸)</div>
				</div>
				<div class="layui-form-item">
					<input placeholder="账 户" type="text" name="username" hover class="layui-input" style="border-color: #c2c2c2" value="admin"/>
				</div>
				<div class="layui-form-item">
					<input placeholder="密 码" type="password" name="password"  hover class="layui-input" style="border-color: #c2c2c2" value="123456"/>
				</div>
				{if config('web.login_captcha')==1}
				<div class="layui-form-item">
					<input placeholder="验证码 : " type="text" maxlength="4" name="captcha" hover class="code layui-input layui-input-inline" style="border-color: #c2c2c2"/>
					<img id="codeimg" class="codeImage" style="cursor: pointer;"/>
				</div>
				{/if}
				<div class="layui-form-item">
					<input type="checkbox" name="remember" title="30天内自动登录" lay-skin="primary" checked>
				</div>
				<div class="layui-form-item">
					<button  class="pear-btn login" lay-submit lay-filter="login" style="background-color: #2D8CF0 !important;color: #fff">
						登 入
					</button>
				</div>
			</form>
		</div>

		<!-- 资 源 引 入 -->
		<script src="/static/component/layui/layui.js"></script>
		<script src="/static/component/pear/pear.js"></script>
		<script>
			layui.use(['form', 'layer', 'jquery', 'element'], function () {
				var $ = layui.jquery
				 , layer = layui.layer
				 , element = layui.element
				 , form = layui.form;
				// 登 录 提 交
				form.on('submit(login)', function(data) {
					layer.load();
					$.ajax({
						type: "POST",
						data: data.field,
						success: function (res) {
							layer.closeAll('loading');
							if (res.code==200){
								layer.msg(res.msg,{icon:1,time:1000},function () {
									location.href = '{$Request.root??"/"}';
								})
							} else {
								layer.msg(res.msg,{icon:2,time:1000},function () {
									initCode();
								})
							}
						}
					});
					return false;
				});
				initCode();
				function initCode() {
					$('#codeimg').attr("src","{$Request.root}/login/verify?data=" + new Date().getTime());
				}
				$('#codeimg').on('click', function () {
					initCode();
				});
			})
			</script>
	</body>
</html>
